-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Optimize multiplications with Pauli operations #7637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize multiplications with Pauli operations #7637
Conversation
Usage: ipython t7603/timing.ipy
…ring base SingleQubitPauliStringGateOperation inherits from GateOperation and PauliString in that resolution order, i.e., with `__mul__`, `__rmul__` defaulting to those of GateOperation. To avoid infinite recursion we make it use the PauliString operations instead. Also avoid creating a new operation in `_try_interpret_as_pauli_string` if the argument is SingleQubitPauliStringGateOperation which is already a PauliString.
NB: Remove the |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7637 +/- ##
=======================================
Coverage 99.56% 99.56%
=======================================
Files 1088 1088
Lines 96048 96062 +14
=======================================
+ Hits 95632 95646 +14
Misses 416 416 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR #7603 made multiplications with Paulis more general and correct, but it also introduced slow down for multiplication with simple Paulis.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 I was wondering about the perf impact of these changes. One other change in that PR that could be a regression is the new self.on(*qubits)
in Gate
, which creates and initializes a new operation. If _try_interpret_as_pauli_string
had an optional qubits parameter, you could just pass the gate and the qubits as-is without having to create a new operation.
That is needed, because |
SingleQubitPauliStringGateOperation.__mul__
,__rmul__
toits PauliString base
Follow-up to #7603
Related to #7588